package cn.vconinfo.app.entity;

import lombok.Data;

@Data
public class RestResponse<T> {
    private Integer code;
    private String msg;
    private T data;
    private String traceId;

    public RestResponse() {
    }

    public RestResponse(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> RestResponse<T> ok(T data) {
        return new RestResponse<>(200, "ok", data);
    }

    public static <T> RestResponse<T> error(T data) {
        return new RestResponse<>(400, "error", data);
    }
}
